# -*- coding: utf-8 -*-
import os
from datetime import datetime
from flask import Blueprint, g

from common import success_resp
from celery_tasks.health.tasks import async_health

health_bp = Blueprint('health', __name__)


@health_bp.get('/health')
def health():
    """
    健康检查
    """
    environ = os.getenv('FLASK_ENV')
    current_time = datetime.now()
    g.name = 'health'
    celery_res = async_health.delay(current_time)
    return success_resp({"now_time": current_time, 'service_name': "py.flask.celery", "environ": environ})
